<!--
 * @Author: 胡海
 * @Date: 2020-11-22 20:52:44
 * @LastEditors: 胡海
 * @LastEditTime: 2020-11-23 09:59:26
 * @Description: 
-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>vue介绍</title>
    <script src="../vue.js"></script>

</head>
<body>
  
   <div id="demo">
    <span v-on:click="clickHandle">{{ message }}</span>
</div>
<script>
    /*let obj = {
        message:"hello,Vue!"
    }
    //声明式渲染
    var vm = new Vue({
        el:"#demo",
        data:obj,
        methods:{
            clickHandle(){
                alert("click")
            }
        }
    });

    console.log( vm.$data );*/
   var arr = [1,2,3,4,5];
    //求数组中每一项的倍数，放在另一个数组中
    /*var newArr = [];
    for(var i = 0; i < arr.length; i++ ){
        newArr.push(arr[i]*2)
    }*/
    var newArr = arr.map(function(item){
        return item*2;
    });
    console.log(newArr);

</script>
</body>
</html>